import java.io.IOException;

import javax.swing.BorderFactory;
import javax.xml.bind.JAXBException;


public class Main {
	
//	improv stuff
	public static Improvise improvise = new Improvise();
	public static XML xml = new XML();
	public static StatisticGathering stats = new StatisticGathering();
	public static SliderGUI sliderGUI= new SliderGUI();

//	-----
	public static String string = "something else";
	public static MidiInDump midiInDump = new MidiInDump();
	public static MidiIn midiIn = new MidiIn();
	public static TextGUI textGUI = new TextGUI();
	public static int[][] notesArray = new int[50000][3];
	public static int notesArrayPointer = 0;
	public static int[][] notesArray_bass = new int[50000][3];
	public static int notesArrayPointer_bass = 0;
	public static int[][] notesArray_arab = new int[50000][3];
	public static int notesArrayPointer_arab = 0;
	public static boolean stillPlaying=true;
	
	public static int[][] learnArray = new int[5000][3];
	public static int learnArrayPointer = 0;
	public static boolean learning = false;
	
	public static int[][] buffer = new int[5000][3];
	public static int bufferPointer = 0;

	
	public static boolean firstNote = false;

	
	public static int quarter=345;
	public static int velocity = 70;
	public static int[] arm = new int[4];
	
	public static Score score = new Score();
	public static boolean wait=false;
	public static boolean listenForBeat=true;
	public static boolean mainListening = true;
	
	public static Play play = new Play();
	
	public static int section = 0;
	public static int repeated=0;
	public static boolean initTempo=true;
	public static boolean same=false;
	public static int same0;
	public static int same1;
	
	public static int stop=0;
	public static int stopcycle=0;
	public static boolean playing=false;
	public static boolean pose = false;
	public static boolean banging = false;
	
	
	public static void main(String args[]) {	
		Object[] stop = {0};
		OSC.main(stop, "/starthead");
		
		try {
			xml.init();
			} catch (JAXBException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			} catch (IOException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}	
		
		OSCin.run();
			
//		PositionArms pos = new PositionArms();
//		Thread posThread = new Thread(pos);
//		posThread.start();
				
		
		// setup midi
		try {
			midiIn.main(12);
		} 
		catch (Exception e) {
			e.printStackTrace();
		}	
	}
	public static void improvise()
	{
		Main.improvise.playing=false;
		Main.improvise.pointer=0;
		Main.improvise.stop=false;
		try {
			Main.improvise.start();
		} catch (JAXBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
